package com.kfm.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/student")
public class StudentController {

    // 只能有一个没有 value 的 RequestMapping
    @RequestMapping()
    public void index(){
        System.out.println("index");
    }


    // 只有 get 请求才能请求此方法
    @RequestMapping(value = {"/add"}, method = {RequestMethod.POST, RequestMethod.PUT})
    public void add(){
        System.out.println("add");
    }

    @RequestMapping(value = "/delete", params = {"id!=1"}, method = RequestMethod.DELETE)
    public void delete(){
        System.out.println("delete");
    }

    /*
            @GetMapping()  // 只能接收 Get 请求
            @PostMapping()
            @PutMapping()
            @DeleteMapping()
     */
    @GetMapping("/test")
    public void test(){
        System.out.println("test");
    }



}
